#ifndef NP_DAOARTICLE_H
#define NP_DAOARTICLE_H

#include <config/Structures.h>
#include <mysql/mysql.h>
#include "Daobase.h"

class DaoArticle : public Daobase
{
public:
  DaoArticle() : Daobase() {}
  DaoArticle(const MYSQL* conn) : Daobase(conn) {}

  void addArticle(const articleInfo::ArticleInfo& article);
  void updateArticle(const articleInfo::ArticleInfo& article);
  bool getArticle(const std::string& articleName, articleInfo::ArticleInfo& article);
  int getArticleList(const std::string& lastupdate, articleInfo::ArticleInfo* articleList);
  int getArticleListByTime(const int lastupdate, articleInfo::ArticleInfo* articleList);
  int getArticleListCount();
  void getArticleMaxID(std::string& buffer);
    unsigned int getArticleMaxID();

private:
  void fillArticle(const MYSQL_ROW& row, articleInfo::ArticleInfo& article);
  int traverseResult(const MYSQL_RES* res, articleInfo::ArticleInfo* articleList);

};

#endif // NP_DAOARTICLE_H
